<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Alpha-欢迎您</title>
    <link rel="shortcut icon" href="../icon/title.ico"/>
    <link rel="stylesheet" href="../css/index.css">
    <link rel="stylesheet" href="../css/bootstrap3.3.7.min.css">
    <script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js" type="text/javascript"></script>
    <script type="text/javascript">uaredirect("http://m.aicll.com","http://www.aicll.com");</script>　　
    <script src="../js/jquery-1.10.2.min.js"></script>
    <script src="../js/bootstrap3.3.7.min.js"></script>
    <script src="../js/index.js"></script>
    <style>
        a:hover{text-decoration: none;color:#000;}
        a{ text-decoration:none;}
        a:link {
            text-decoration: none;
        }
        .content{
            width: 80%;margin: auto}
        h3{
            width: 100%;text-align: center;}
        .xmp{color:#3d464d;;text-indent: 2em;}
        pre{line-height: 200%;font-size: 14px;}

    </style>
    <script>

    </script>
</head>
<body>

<div class="warp">
    <div>
        <h1><a href="../index.html">Alpha</a></h1>
    </div>
    <nav class="navbar navbar-default" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse"
                        data-target="#example-navbar-collapse">
                    <span class="sr-only">切换导航</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#"></a>
            </div>
            <div class="collapse navbar-collapse" id="example-navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">javascript</a></li>
                    <li><a href="#">css</a></li>
                    <li><a href="#">jquery</a></li>
                    <li><a href="#">angular</a></li>
                    <li><a href="#">其他</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="img">
        <img src="../images/javaScript.png" style=";height: 300px;background:#ccc;" alt="">
    </div>
    <hr>
    <!--返回顶部箭头-->
    <div id="top" style="width: 50px;height: 50px;background-color: #999;position: fixed;right: 50px;bottom:50px;text-align: center;line-height: 50px;display: none;">
        <b>
            <a style="text-decoration:none;color:#fff;;" href="javascript:;">顶部</a>
        </b>
    </div>
<!--content主要内容-->
    <div class="content">
        <h3><b>自动识别设备进行PC端和手机端页面跳转</b></h3>
        <div>
            <p>1、复制以下代码，把跳转网址改成自己的</p>
            <p>把代码放在head前面：</p>
            <pre>
      try { //try和catch 异常处理  出现出错  会在catch的err里面，一般都是成对出现;
                //navigator.userAgent 检查设备系统信息 返回string值
            if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) ;//利用正则match进行查找;
            {
                //要跳转的页面，window.location：URL跳转
                //window.location="https://alpha0729.github.io/Alpha.github.io/";
            }else {
                //window.location="https://www.baidu.com/";
            }
       }
    catch(err){}
</pre>
        </div>
    </div>
    <hr>
    <div class="footer">
        <div>
            <img src="" alt="">
            <img src="" alt="">
            <img src="" alt="">
            <img src="" alt="">
            <img src="" alt="">
            <img src="" alt="">
        </div>
        <div class="footer-bottom">
            <p>这是一段内容</p>
        </div>
    </div>
</div>

</body>
</html>
<script>
    window.addEventListener('scroll', function () {
        var oTop=document.getElementById('top');
        var oH=document.documentElement.clientHeight;
        var oS=document.body.scrollTop;
        if(oH+oS>oH){
            oTop.style.display="block";

        }else {
            oTop.style.display="none";
        }
        oTop.onclick= function () {
            var timer=null;
            clearInterval(timer);
            timer=setInterval(function () {
                document.body.scrollTop=(oS*=0.8);
                if (oS<=1){
                    oS=0;
                    clearInterval(timer);
                    oTop.style.display="none";
                    //alert(oS)
                }
            },30)
        }
    },false);
</script>